package manager
{
	import flash.utils.ByteArray;
	import flash.utils.Endian;
	
	import net.SocketEx;

	public class NetMgr
	{
		private var connection_value:Boolean = false; //是否连接
		
		private static var instance:NetMgr;
		
		private var socket:SocketEx;
		
		public function NetMgr()
		{
			socket = new SocketEx();
			socket.endian = Endian.LITTLE_ENDIAN;
			socket.sendByteArray.endian = Endian.LITTLE_ENDIAN;
		}
		
		public static function get inst():NetMgr
		{
			return instance ||= new NetMgr();
		}

		public function get gameSocket():SocketEx
		{
			return socket;
		}
		
		public function get gameByteArray():ByteArray
		{
			return socket.sendByteArray;
		}
		
		public function send():void
		{
			socket.send();
		}
		
		public function resCallBack(cmdId:uint, callback:Function):void
		{
			socket.resCallBack(cmdId, callback);
		}

		public function get isConnection():Boolean
		{
			return connection_value;
		}

		public function set isConnection(value:Boolean):void
		{
			connection_value = value;
		}

		
	}
}